"""meiduo_mall URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.urls import path
from . import views

urlpatterns = [
    # 权限列表管理
    path('permission/perms/', views.PermissionView.as_view({'get': 'list', 'post': 'create'})),
    path('permission/content_types/', views.ContentTypeView.as_view()),
    path('permission/simple/', views.PermissionSimpleView.as_view()),
    path('permission/perms/<int:pk>/', views.PermissionView.as_view(
        {'get': 'retrieve', 'put': 'update', 'delete': 'destroy', 'patch': 'partial_update'})),
    # 用户组权限管理
    path('permission/groups/', views.GroupView.as_view({'get': 'list', 'post': 'create'})),
    path('permission/simple/', views.GroupPermListView.as_view()),
    path('permission/groups/<int:pk>/', views.GroupView.as_view(
        {'get': 'retrieve', 'put': 'update', 'delete': 'destroy', 'patch': 'partial_update'})),
    # 新建管理员用户可选分组
    path('permission/groups/simple/', views.AdminSimpleView.as_view()),
    # 管理员管理
    path('permission/admins/', views.AdminView.as_view({'get': 'list', 'post': 'create'})),
    # path('permission/groups/simple/', views.AdminSimpleView.as_view()),
    path('permission/admins/<int:pk>/', views.AdminView.as_view(
        {'get': 'retrieve', 'put': 'update', 'delete': 'destroy', 'patch': 'partial_update'})),
]
